package main;

import java.util.*;
import java.lang.*;

import enums.DayOfWeek;
import enums.Sex;
import enums.Speciality;
import enums.Subject;



public class University {

	public static void main(String[] args) {	

		//Create list of students
		List<Student> studentsList = new ArrayList<Student>();
		Student s13 = new Student();
		s13.setSex(Sex.FEMALE);
		s13.printSudentBasicInfo();
		Student s1 = new Student("Pavel","Pavloff",Sex.MALE, Speciality.PROGRAMMING);
		Student s2 = new Student("Vika","Vikova",Sex.FEMALE, Speciality.PROGRAMMING);
		Student s3 = new Student("Tania","Taneva",Sex.FEMALE, Speciality.PROGRAMMING);
		Student s4 = new Student("Moisha","Rabinovich",Sex.MALE, Speciality.PROGRAMMING);
		Student s5 = new Student("Tania","Igorevf",Sex.FEMALE, Speciality.PROGRAMMING);
		Student s6 = new Student("Vadim","Rabinovich",Sex.MALE, Speciality.PROGRAMMING);
		
		Student s7 = new Student("Olga","Olgova",Sex.FEMALE,Speciality.MUSIC);
		Student s8 = new Student("Anton","Antonov",Sex.MALE,Speciality.MUSIC);
		Student s9 = new Student("Denis","Denisov",Sex.MALE,Speciality.MUSIC);
		Student s10 = new Student("Igor","Igorov",Sex.MALE,Speciality.MUSIC);
		Student s11 = new Student("Olga","Gribova",Sex.FEMALE,Speciality.MUSIC);
		
		//set personal info for student 1(as example)
		s1._PersonalInfo().setCity("Kyiv");
		s1._PersonalInfo().setDateOfBirth("10.08.1995");
		s1._PersonalInfo().setStreet("Grinchenko 2/1");
		s1._PersonalInfo().setZip("10027");
		
		studentsList.add(s1);
		studentsList.add(s2);
		studentsList.add(s3);
		studentsList.add(s4);
		studentsList.add(s5);
		studentsList.add(s6);
		studentsList.add(s7);
		studentsList.add(s8);
		studentsList.add(s9);
		studentsList.add(s10);
		studentsList.add(s11);
		
		//Remove students
		studentsList.remove(s1);
		studentsList.remove(s11);
		
		//Create list of teachers
		List<Teacher> musicTeachersList = new ArrayList<Teacher>();
		List<Teacher> programmingTeachersList = new ArrayList<Teacher>();
		Teacher t1 = new Teacher("Johann", "Bach", Sex.MALE, Subject.CHOIR);
		Teacher t2 = new Teacher("Amadeus", "Mozart", Sex.MALE, Subject.CHOIR);
		Teacher t3 = new Teacher("Viacheslav", "Krukovsky", Sex.MALE, Subject.JAVA_LANGUAGE);
		Teacher t4 = new Teacher("Aleksander", "Baglai", Sex.MALE, Subject.C_LANGUAGE);
		musicTeachersList.add(t1);
		musicTeachersList.add(t2);
		programmingTeachersList.add(t3);
		programmingTeachersList.add(t4);
		
		//Create list of groups		
		Group musicGroup = new Group(Speciality.MUSIC);
		musicGroup.setGroupName("Mus");
		musicGroup.setCurator(t1);
		Group programmersGroup = new Group(Speciality.PROGRAMMING);
		programmersGroup.setGroupName("Prog");		
		programmersGroup.setCurator(t3);
		List<Group> groupsList = new ArrayList<Group>();
		groupsList.add(programmersGroup);
		groupsList.add(musicGroup);
		
		//if need to remove a group
		//groupsList.remove(musicGroup);
		
		
		
		//Create lists of students for each group
		List<Student> musicGroupStudentsList = new ArrayList<Student>();
		List<Student> programmersGroupStudentsList = new ArrayList<Student>();
		
		//split students into groups according the speciality
		for (Student student : studentsList) {	
			if(student.getSpeciality().equals(Speciality.MUSIC)){
				musicGroupStudentsList.add(student);				
			}else{
				programmersGroupStudentsList.add(student);
			}	
		}
		//print groups
		for (Group group : groupsList) {	
			System.out.println("\nGroup '"+group.getGroupName()+"-"+group.getGroupID()+"'");
			System.out.println("Curator: "+group.getCurator().getPersonsFirstName());
			System.out.println("\nCurriculum MONDAY:");
			List<String> mondayCurriculum = group._Curriculum().getCurriculum(group, DayOfWeek.MON);
			for(String subject : mondayCurriculum){
				System.out.println(subject);
			}
			System.out.println("\nCurriculum TUESDAY:");
			List<String> tuesdayCurriculum = group._Curriculum().getCurriculum(group, DayOfWeek.TUE);
			for(String subject : tuesdayCurriculum){
				System.out.println(subject);
			}
			if(group.getSpeciality().equals(Speciality.MUSIC)){
				System.out.println("\nMusic Teachers:");
				for (Teacher teacher : musicTeachersList) {
					teacher.printTeacherBasicInfo();
				}			
				System.out.println("\nMus Students list:");
				for (Student student : musicGroupStudentsList) {
					System.out.println("Student Index = "+musicGroupStudentsList.indexOf(student));
					System.out.println("ID = "+ student.getID());
					student.printSudentBasicInfo();
					System.out.println();
				}				
			}else{
				System.out.println("\nProgramming Teachers:");
				for (Teacher teacher : programmingTeachersList) {
					teacher.printTeacherBasicInfo();
				}	
				System.out.println("\nProg Students list:");
				for (Student student : programmersGroupStudentsList) {
					System.out.println("Student Index = "+programmersGroupStudentsList.indexOf(student));
					System.out.println("ID = "+ student.getID());
					student.printSudentBasicInfo();
					System.out.println();
				}
			}		
		}	
		System.out.println("\nProgrammers group size = "+programmersGroupStudentsList.size());
		System.out.println("\nMusic group size = "+musicGroupStudentsList.size());
		//print additional info
		System.out.println("\nPersonal info of the student:");
		System.out.println(s1.getPersonsFirstName()+" "+s1.getPersonsLastName()+", id = "+ s1.getID()+", "
		+s1._PersonalInfo().getDateOfBirth()+", "+s1._PersonalInfo().getCity()+", "
		+s1._PersonalInfo().getStreet()+ ", "+s1._PersonalInfo().getZip());		
	}
}
        